<div id="edit_form">

  <?= Form::open('/user/edit', array('method' => 'post')); ?>
  <?= Form::input('token_form', Security::token(), array('type' => 'hidden')) ?>
  <dl>
    <dt><?= Form::label('username', 'Username:');?></dt>
    <dd><?= Form::input('username', $user->username, array('disabled' => 'disabled')); ?></dd>
    
    <dt><?= Form::label('email', 'Email:');?></dt>
    <dd><?= Form::input('email', $user->email, array('disabled' => 'disabled'));?></dd>
    
    <dt><?= Form::label('name', 'Name:'); ?></dt>
    <dd>
    <?= Form::input('name', $post["name"]); ?>
    <?
      if(isset($errors["name"])){
      ?> 
      <span class="error">Hey! there are errors in your new name.</span>
      <?
      }
    ?>
    </dd>
    
    <dt><?= Form::label('lastname', 'Lastname:'); ?></dt>
    <dd><?= Form::input('lastname', $post["lastname"]); ?></dd>
    
    <dt><?= Form::label('sex', 'Gender:'); ?></dt>
    <?
    $sex = array('Mujer', 'Hombre');
    ?>
    <dd><?= Form::select('sex', $sex, $post["sex"]); ?></dd>
    
    <?
    $days = Date::days(1, date("Y"));
    $months = Date::months();
    $aux_years = array_reverse(Date::years(date("Y") - 100, date("Y")));
    foreach($aux_years as $aux_year){
      $years[$aux_year] = $aux_year;
    }
    ?>
    
    <dt><?= Form::label('birthdate', 'Birthdate:');?></dt>
    <dd>
      <?= Form::select('birthdate_day', $days, $post["birthdate_day"]); ?>
      <?= Form::select('birthdate_month', $months, $post["birthdate_month"]); ?>
      <?= Form::select('birthdate_year', $years, $post["birthdate_year"]); ?>
    </dd>
    
    <dt><?= Form::label('headline', 'Headline:'); ?></dt>
    <dd><?= Form::input('headline', isset($post["headline"]) ? $post["headline"] : "", array('maxlength' => 100)); ?></dd>
    
    <dt><?= Form::label('bio', 'Bio:'); ?></dt>
    <dd><?= Form::textarea('bio', isset($post["bio"]) ? $post["bio"] : "", array('maxlength' => 400)); ?></dd>
    
    <dt><?= Form::label('country', 'Country:'); ?></dt>
    <dd><?= Form::select('country', $countries, $post["country"]); ?></dd>
    
    <dt><?= Form::label('hometown', 'Hometown:'); ?></dt>
    <dd><?= Form::input('hometown', isset($post["hometown"]) ? $post["hometown"] : "", array('maxlength' => 100)); ?></dd>
  
    <dt><?= Form::label('website', 'Website:'); ?></dt>
    <dd><?= Form::input('website', isset($post["website"]) ? $post["website"] : "", array('maxlength' => 150)); ?></dd>
  
    <dt>
      <?= Form::submit(NULL, 'Save changes');?>
    </dt>
  </dl>
  <?= Form::close(); ?>
</div>